package com.yaolifei.flower.core;

import javax.sql.DataSource;

import org.nutz.dao.impl.NutDao;
import org.nutz.ioc.impl.NutIoc;
import org.nutz.ioc.loader.json.JsonLoader;

import com.alibaba.druid.pool.DruidDataSource;

public final class Global {

	private Global() {
	}

	private static NutIoc ioc = null;

	public static NutIoc getNutIoc() {
		if (ioc == null)
			ioc = new NutIoc(new JsonLoader("objects.js"));
		return ioc;
	}

	public static DataSource getDataSource() {
		return getNutIoc().get(DruidDataSource.class, "dataSource");
	}

	public static NutDao getNutDao() {
		return getNutIoc().get(NutDao.class, "nutDao");
	}

}